package com.aimei.user.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

@RequestMapping("/api/user")
@Controller
public class UserController {
       @RequestMapping("/sec/getCode")
       @ResponseBody
       public Boolean getCode() {
              return true;
       }

       @RequestMapping("/seca/getUserName")
       @ResponseBody
       public String getUserName() {
              return "";
       }



       @RequestMapping("/test")
       @ResponseBody
       public Boolean test(HttpServletResponse response) {
              response.setStatus(200);
              response.addHeader("addHeader","addHeader1");
              response.addHeader("addHeader","addHeader2");
              response.addDateHeader("Date",(new Date()).getTime());
              response.addIntHeader("integer",100);
              response.setHeader("addHeader","setHeader1");
              response.setHeader("addHeader","setHeader2");
              Cookie cookie=new Cookie("cooik","Iamcooik");
              Cookie cookie2=new Cookie("cooik","Iamcooik2");
              cookie.setDomain("www.ipzixun.net");
              cookie.setPath("/");
              response.addCookie(cookie);
              return true;
       }
}
